module.exports = {
	/**
	 * 查询角色列表
	 * @url client/wechat/selects/pub/selects 前端调用的url参数地址
	 * 表名
	 * @dbName 查询的表的名称
	 * data 请求参数 说明
	 * @param {Number}         pageIndex 当前页码
	 * @param {Number}         pageSize  每页显示数量
	 * @param {Array<Object>}  sortRule  排序规则
	 * @param {object}         formData  查询条件数据源
	 * @param {Array<Object>}  columns   查询条件规则
	 * res 返回参数说明
	 * @param {Number}         code      错误码，0表示成功
	 * @param {String}         msg       详细信息
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { thumb } = data
		let res = { code: 0, msg: '' };
		// 业务逻辑开始-----------------------------------------------------------
		let plaform = ''
		if(originalParam.context.PLATFORM === 'mp-weixin'){
			plaform = 'wx'
		}
		res.msg = "缓存查询"
		var cache = await vk.globalDataCache.get(plaform+'_setting');
		if(cache) return cache
		
		let base_config = await vk.baseDao.findByWhereJson({
			dbName: 'bus-wx-config',
			whereJson: {
				config_key: 'base_config'
			},
		});
		res.base_config = base_config
		if(base_config.copyright_text && base_config.copyright_logo){
			res.base_config.copyright_text = decodeURIComponent(base_config.copyright_text)
			res.base_config.copyright_logo = decodeURIComponent(base_config.copyright_logo)
		}
		
		let score_config = await vk.baseDao.findByWhereJson({
			dbName: 'bus-wx-config',
			whereJson: {
				config_key: 'score_config'
			},
		});
		res.score_config = score_config
		
		let client_config = await vk.baseDao.findByWhereJson({
			dbName: 'bus-wx-config',
			whereJson: {
				config_key: plaform+'_config'
			},
		});
		res.client_config = client_config
		
		await vk.globalDataCache.set(plaform+'_setting', res, 0);
		res.msg = "数据库查询"
		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}

}